"use strict"

const _ = require('lodash/fp')
const lives = require('./lives')
const run = require('./run')

const requests = lives.map(
    live => {
        if (_.isString(live.run)) {
            return run[live.run](live);
        } else if (_.isFunction(live.run)) {
            return live.run()
        }

        return false
    }
)

module.exports = () => 
    Promise.all(requests)
    .then(_.flattenDeep)
    .then(_.filter(_ => _.id))

